package kafka010;

import org.apache.kafka.common.network.Send;

import java.util.concurrent.TimeUnit;

/**
 * @author pizhihui
 * @date 2024-06-14 09:25
 */
public class MetaUpdateDemo {


    public static void main(String[] args) throws InterruptedException {


        new Meta().start();




        System.out.println("main end..........");


        TimeUnit.SECONDS.sleep(2);

        new Sender().doSend();

    }


}

class Sender extends Thread{

    @Override
    public void run() {
        while (true){
            doSend();
        }
    }


    public void doSend(){
        System.out.println("调用 send 开始,等待元数据更新");
        waitUpdate();

    }

    private synchronized void waitUpdate() {
        try {
            wait(6000);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

class Meta extends Thread {
//    @Override
//    public void run() {
//        try {
//            System.out.println("开始等待唤醒.....");
//            wait(6000);
//            System.out.println("唤醒后处理任务");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
}
